﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Model.Answer>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Sửa câu trả lời
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
    <% using (Html.BeginForm("Edit", "Answer", FormMethod.Post, new { id = "adminForm" }))
       {%>
        <%= Html.ValidationSummary(true) %>

        <fieldset>
            <legend>Sửa</legend>
			<font color="red">*</font> là trường bắt buộc phải nhập.
			<table class="admintable">
				<tbody>
				<tr>
					<td class="key">Câu hỏi</td>
					<td><%=Html.Encode(Model.Question.Title) %></td>
				</tr>
				
				<tr>
					<td class="key">Tên người trả lời (<font color="red">*</font>)</td>
					<td>
						<%= Html.TextBoxFor(m=>m.AnswerName, new { @class = "required", maxlength = 250 })%>
					</td>
				</tr>
				<tr>
					<td class="key">Email (<font color="red">*</font>)</td>
					<td>
						<%= Html.TextBoxFor(m=>m.AnswerEmail, new { @class = "required email", maxlength = 250 })%>
					</td>
				</tr>
				
				<tr>
					<td class="key">Xuất bản</td>
					<td>
						<%= Html.CheckBox("chkPubYN",Model.PubYN.HasValue && Model.PubYN.Value==true?true:false)%>
					</td>
				</tr>
				<tr>
					<td class="key">Mô tả</td>
					<td>
						<%= Html.TextAreaFor(m=>m.Answers, new { style="width: 500px; height: 200px" })%>
					</td>
				</tr>

				<tr>
					<td colspan="2" align="center"><input type="submit" value="Lưu" /></td>
				</tr></tbody>
			 </table>
        </fieldset>

    <% } %>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate({
                rules: {
                    AnswerName: "required",
                    AnswerEmail: "required"
                },
                messages: {
                    AnswerName: "Trường này là bắt buộc, vui lòng nhập dữ liệu!",
                    AnswerEmail: "Trường này là bắt buộc, vui lòng nhập dữ liệu!"
                }
            });
        });
        tinyMCE.init({
            mode: "exact",
            plugins: "paste,imagemanager",
            theme: "advanced",
            elements: "Answers",
            theme_advanced_buttons1: "pastetext,separator,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });
	</script>
<% } %>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Quay lại", "/Answer", "back")%>
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Header" runat="server">
	Sửa câu hỏi
</asp:Content>
